package sakila.dal;

import java.util.List;

import sakila.commonprocess.ProcessResult;
import sakila.dto.film.BaseDTO;
import sakila.sakilaexcetion.SakilaException;



/**
 * The Interface IDataAcess contain CRUD action apply in data base.
 */
public interface IDataAcess
{

	/**
	 * Delete record on table.
	 * 
	 * @return the process result
	 * @throws SakilaException the
	 */
	public ProcessResult delete() throws SakilaException;

	/**
	 * Gets the all record form table.
	 * 
	 * @param <T> the generic type
	 * @return the all
	 * @throws SakilaException the
	 */
	public <T extends BaseDTO> List<T> getAll() throws SakilaException;

	/**
	 * Gets the by id.
	 * 
	 * @param <T> the generic type
	 * @param id the id
	 * @return T
	 * @throws SakilaException the
	 */
	public <T extends BaseDTO> T getById(int id) throws SakilaException;

	/**
	 * Insert new record into table.
	 * 
	 * @param newRecord the record to insert
	 * @return the process result
	 * @throws SakilaException the SakilaException
	 */
	public ProcessResult insert(BaseDTO newRecord) throws SakilaException;

	/**
	 * Update record.
	 * 
	 * @param record the record
	 * @return the process result
	 * @throws SakilaException the
	 */
	public ProcessResult update(BaseDTO record) throws SakilaException;
}
